This invention relates to a device for measuring the density of a liquid or gaseous medium, comprising a support by which an oscillating body to be introduced into the medium is held in a position permitting its oscillation, at least one oscillation detector for producing, during operation of the device, a detector signal depending on the oscillation of the body, at least one oscillating generator for exciting the oscillating body, and electronic circuitry connected to the oscillation detector and oscillating generator and including a period meter or a frequency meter for determining the period or frequency of oscillation, and at least one phase shifter for supplying the oscillation generator with an excitation signal shifted in phase, through a phase angle, relative to the detector signal produced by the oscillation detector. More particularly, the present invention is directed to an improved device, of this type, for measuring the density of a liquid or gaseous medium.